function Lbeam
clc
%close all
addpath('../');
addpath('../../');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% read mesh
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
projDir = '/home/hbui/kratos_janosch';
%coarse (structure) mesh
projName = 'Lbeam.gid';
% fn = [projDir '/' projName '/' 'Lbeam.msh'];
fn = [projDir '/' projName '/' 'Lbeam2.msh'];

mg = fem2.gid.GidMeshGenerator(fn);
mesh = mg.getMesh(2);
mesh.setNumberOfFields(2);
for i=1:mesh.countNodes()
    mesh.getNode(i-1).setId(i);
end
%plotMesh(mesh);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% conditions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
du = -2;
lambda = 0.5:0.2:2;
meshUtil = fem2.MeshUtilities(mesh);
c1 = fem2.Constraint([0 0]);
c2 = fem2.Constraint([1 0]);
c2.setValue(1,du);
mesh.setConstraint(c1,meshUtil.seekNodesOnSurface(0,1,0));
meshUtil.seekNode([1 -0.5]).setConstraint(c2);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% element declaration
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
M = fem2.Model(mesh);
nf = mesh.countFaces();
E = 2;
nu = 0.3;
ft = 1.9;
H = 0;
K = 2;
for i=1:nf
    e = fem2.MatlabStructuralElement(mesh.getFace(i-1));
    M.addElement(e);
    %create struct to contain element state variables
    es = createElementContainer();
    es.E = E;
    es.nu = nu;
    es.TensileStrength = ft;
    es.KinematicHardeningModulus = H;
    es.IsotropicHardeningModulus = K;
    elements(i) = es;
end
elements = InitializeMaterial(elements,M);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% time steps iteration
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
post = fem2.gid.GidPost(projDir,projName);
post.clearAllPostFiles();

postProcessInfo.infoList = {'vonmises-gid writer'};
postProcessInfo.infoParam = {post};

[elements,output] = solving_strategy_static_2(elements,M,...
    lambda,50,1e-6,postProcessInfo);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% post process
%%%%%%%%%%%%%%%%%%%%%%%%%%%%

rmpath('../');
rmpath('../../');

